package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description: 公用常量
 * @Data: 2022/9/5 21:09
 * @Pacakge: com.qf.controller
 * @ClassName: ServletAPI
 * @Author: fan
 */
@Controller
@RequestMapping("ServletAPI")
public class ServletAPI {
    @RequestMapping("testServletAPI")
    public void testServletAPI(HttpServletRequest request, HttpServletResponse response){
        try {
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        System.out.println("姓名"+name+"年龄 " + age);
        //请求转发
            request.getRequestDispatcher("/WEB-INF/pages/success.jsp").forward(request,response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
